
** looking at variation in treatment for probability
preserve

	g _myyear = year-1
	tostring _myyear, g(_myyearstr)
	g _mymonth = "8"
	g _myday = "1"
	g _mydatestring = _myyearstr + "-"+ _mymonth + "-" + _myday
	g _mydate = date(_mydatestring, "YMD")
	
	g obsdate_adj_1p = obsdate_1p - _mydate
	g obsdate_adj_2p = obsdate_2p - _mydate
	g obsdate_adj_3p = obsdate_3p - _mydate
	g obsdate_adj_1m = obsdate_1m - _mydate
	g obsdate_adj_2m = obsdate_2m - _mydate
	
	g confdate_adj_1p = confdate_1p - _mydate
	g confdate_adj_2p = confdate_2p - _mydate
	g confdate_adj_3p = confdate_3p - _mydate
	g confdate_adj_1m = confdate_1m - _mydate
	g confdate_adj_2m = confdate_2m - _mydate

	drop _myyear _myday _mymonth _mydate _mydatestring _mydate _myyearstr

	
	* center the dates
	replace obsdate_adj_2m = obsdate_adj_2m - 15 if year == 2010
	replace obsdate_adj_2m = obsdate_adj_2m - 3 if year == 2011
	
	keep id year haz_m2_totp haz_p2_totp nothreat_m2 nothreat_p2 obsdate_adj_* nothreat_m2_all
	duplicates drop id year, force
	
		
	twoway 	(scatter haz_m2_totp obsdate_adj_2m if obsdate_adj_2m <= 241) ///
			, xline(242 221) ytitle("Observation Probability")  xtitle("Day of External Observation (M2)") ///
			text(0.125 221 "End P2", orientation(vertical) placement(east)) text(0.125 242 "Standardized Tests", orientation(vertical) placement(east))
	
	graph export "$output_dir\Figures\_Figure16_VariationInProb_preTestOnly.png", replace width(1000) height(750)	
	
	reg haz_m2_totp obsdate_adj_2m if haz_m2_totp <= 0.2 & obsdate_adj_2m <= 241
	
restore